﻿<cfsilent>
	<cfscript>
		
		studentId = event.getArg('STU');
		classId = event.getArg('class');
		
		/* 学生信息 */
		sql = "SELECT 
					t_student.cls_id, t_student.area_code, 
					t_student.stu_name, t_student.stu_id,
					t_student.stu_sex, t_student.stu_birthday,
					t_idcard_type.idtype_name, t_idcard_type.idtype, 
					t_student.stu_idcard, t_student.stu_name_used,
					t_nation.nation_name, t_nation.nation_code, 					
					t_student.sbj_direction, t_student.stu_name_english, 
					t_student.nationality, t_student.continent    
				FROM 
					t_student  
					INNER JOIN t_idcard_type ON t_idcard_type.idtype = t_student.idtype 
					INNER JOIN t_nation ON t_nation.nation_code = t_student.nation_code 
				WHERE 
					t_student.stu_id = :studentId ";
				
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		
		rs_studentEntity = queryObj.execute( sql=sql ).getResult();
		
		/* 学生学籍信息 */
		sql = "SELECT  
					t_student_status.student_prop, t_student_status.candidatesno,
					t_student_status.date_join, t_student_status.status_code, 
					t_student_status.homeaddr, t_student_status.zipcode, 
					t_student_status.acad_type, t_student_status.pt_date, 
					t_student_status.st_id ,
					t_student_status.f_id,
					t_student_status.is_married, 
					t_student_status.stu_email, t_student_status.stu_tel, 
					t_student_status.ch_addr    
				FROM 
					t_student_status 
				WHERE 
					t_student_status.stu_id = :studentId ";
				
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		
		rs_profileEntity = queryObj.execute( sql=sql ).getResult();
		
		rs_st = queryNew("st_name");
		rs_f = queryNew("f_name");
		
		/*学生类型*/
		if( rs_profileEntity.st_id neq "" ){
			
			sql = "SELECT to_char(i_code_Info.name) st_name from i_code_info where code_Id = :codeId";
			
			queryObj = new Query( datasource=application.dnsSlave ) ;
			
			queryObj.addParam( name="codeId", value=rs_profileEntity.st_id, cfsqltype="cf_sql_varchar" );
		
			rs_st = queryObj.execute( sql=sql ).getResult();
				
		}
		
		/*经费来源*/
		
		if( rs_profileEntity.f_id neq "" ){
			
			sql = "SELECT to_char(i_code_Info.name) f_name from i_code_info where code_Id = :codeId";
			
			queryObj = new Query( datasource=application.dnsSlave ) ;
			
			queryObj.addParam( name="codeId", value=rs_profileEntity.f_id, cfsqltype="cf_sql_varchar" );
		
			rs_f = queryObj.execute( sql=sql ).getResult();
				
		}
		
		/* 学生所在行政班 */
		sql = "SELECT grade, cls_found, cls_name, sbj_id FROM t_class WHERE cls_id = :classId ";
				
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="classId", value=rs_studentEntity.cls_id, cfsqltype="cf_sql_char" );
		
		rs_classEntity= queryObj.execute( sql=sql ).getResult();
		
		
		/* 班级归属专业 */
		sql = "SELECT 
					t_subject.sbj_id, t_institute.institute_name,
					t_subject.sbj_name, t_subject.level_code,
					t_subject.schooling_length 
				FROM 
					t_subject 
					INNER JOIN t_institute ON t_institute.institute_id = t_subject.institute_id 
				WHERE
					t_subject.sbj_id = :subjectId  ";
					
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="subjectId", value=rs_classEntity.sbj_id, cfsqltype="cf_sql_varchar" );
		
		rs_subjectEntity = queryObj.execute( sql=sql ).getResult();
		
		
		/* 民族信息 */
		sql = "SELECT nation_code, nation_codez, nation_name FROM t_nation ORDER BY nation_name ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		rs_nation = queryObj.execute( sql=sql ).getResult();
		
		/* 国家信息 */
		sql = "SELECT name FROM i_code_info where field_id = '1' ORDER BY length(name),name ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		rs_continent = queryObj.execute( sql=sql ).getResult();
		
		/* 洲别信息 */
		sql = "SELECT name FROM i_code_info where field_id = '2' ORDER BY length(name),name ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		rs_country = queryObj.execute( sql=sql ).getResult();
		
		
		/* 经费来源 */
		sql = "SELECT code_id, name FROM i_code_info where field_id = '3' ORDER BY length(name),name ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		rs_funds = queryObj.execute( sql=sql ).getResult();
		
		
		/* 行政区划 */
		sql = "SELECT area_code, area_name FROM t_dict_china_area ORDER BY area_code asc ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		rs_area = queryObj.execute( sql=sql ).getResult();
		
		
		/* 证件类型 */
		sql = "SELECT 
					 idtype, idtype_name, 
					 CASE WHEN idtype_notice IS NULL THEN '-' ELSE idtype_notice END idtype_notice 
				FROM 
					 t_idcard_type 
				ORDER BY 
					 idtype_name asc ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		rs_idType = queryObj.execute( sql=sql ).getResult();
		
		
		/* 行政班信息 */
		sql = "SELECT 
					 t_class.cls_id, t_class.cls_name, t_class.grade, 
					 t_subject.sbj_id, t_subject.sbj_name, 
					 t_institute.institute_id, t_institute.institute_name 
				FROM 
					 t_class 
					 INNER JOIN t_subject ON t_subject.sbj_id = t_class.sbj_id 
					 INNER JOIN t_institute ON t_institute.institute_id = t_subject.institute_id 
				WHERE 
					 t_class.grade > :miniGrade ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="miniGrade", value=year(now())-5, cfsqltype="cf_sql_char" );
		
		rs_class = queryObj.execute( sql=sql ).getResult();
		
		
		/* 培养方式 */
		sql = "SELECT f_id, foster_type FROM t_foster_type order by f_id";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		rs_foster = queryObj.execute( sql=sql ).getResult();
		
		
		/* 学生类别 */
		sql = "SELECT st_id, student_type FROM t_student_type WHERE st_id LIKE '2_' OR st_id LIKE '9_' order by st_id ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		
		rs_studentType = queryObj.execute( sql=sql ).getResult();
		

		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		propAdvice = getProperty("serviceFactory").getBean("studentPropertyAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		
		event.setArg("pageTitle", "教学运行基础数据 - 学生学籍 - 修订学籍档案 - " & rs_studentEntity.stu_name);
		
		propAdvice.parseProperty( rs_profileEntity.student_prop );
		
		targetArgs = structNew();
		structInsert(targetArgs, "SubID", rs_subjectEntity.sbj_id, true);
		structInsert(targetArgs, "Grade", rs_classEntity.grade, true);
		
		passArgs = structNew();
		structInsert(passArgs, "Class", classId, true);
		
		
		currentTab = event.getArg("TabID", "labBasic");

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('studentByClass', passArgs)#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">班级学生列表</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>修订学籍档案 - <cfoutput>#rs_studentEntity.stu_name#</cfoutput>
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labBasic">class="active"</cfif> id="labBasic" tabTarget="Basic">个人信息</span>
						<span <cfif currentTab eq "labPicture">class="active"</cfif> id="labPicture" tabTarget="Picture">照片</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Basic" class="tabContent">
					<div class="noticeBlock">
						<h3>个人基本资料</h3>
						<hr/>
					</div>
					
					<cfif event.getArg("OP") eq "profile">
						<div class="systemNotice">
							<h3>数据已保存</h3>
							<div><span class="img icon16x16 message"></span>学生档案资料已更新为最近状态</div>
						</div>
					</cfif>
					
					<form id="formBasic" onSubmit="javascript:return processVerfiyForm('formBasic');" class="formWrapper" method="post" action="<cfoutput>#buildURL('studentProfileUpdateDo')#</cfoutput>">
						
						<input type="hidden" name="StudentID" value="<cfoutput>#rs_studentEntity.stu_id#</cfoutput>" />
						<input type="hidden" name="targetTab" value="labBasic" />
                              <input type="hidden" name="class" value="<cfoutput>#classId#</cfoutput>" />
						
						<div class="label">
							<span class="req">*</span><b>学号</b>
							<input name="StuId" type="text" disabled="disabled" class="typeTextTiny inlinePart" value="<cfoutput>#rs_studentEntity.stu_id#</cfoutput>"/>（暂不支持修改学号）
							
						</div>
                              
						<div class="label">
                            
							<span class="req">*</span><b>中文名</b>
							<input name="StudentName" id="StudentName" type="text" class="typeTextTiny inlinePart" verification="required" maxlength="15" value="<cfoutput>#event.getArg('StudentName', rs_studentEntity.stu_name)#</cfoutput>" />
							
							护照名
							<input name="englishName" id="englishName" type="text" class="typeText inlinePart" verification="required" maxlength="60" value="<cfoutput>#event.getArg('EnglishName', rs_studentEntity.stu_name_english)#</cfoutput>" />
						
						</div>
						
						<div class="label">
							<span class="req">*</span><b>护照号</b>
						
							<input name="IDCard" id="IDCard" type="text" class="typeTextTiny inlinePart" verification="required" maxlength="18" value="<cfoutput>#event.getArg('IDCard', rs_studentEntity.stu_idcard)#</cfoutput>" />
                                   
                                  护照有效期
							<input name="ptDate" id="ptDate" type="text" class="typeDate" maxlength="10" value="<cfoutput>#event.getArg('ptDate', rs_profileEntity.pt_date)#</cfoutput>" /><span id="calendarTriggerPT" class="btnCalendar"></span>
						</div>
					
						<div class="label">
							<span class="req">*</span><b>出生日期</b>
							<input name="Birthday" id="Birthday" type="text" class="typeDate" maxlength="10" verification="date" value="<cfoutput>#event.getArg('Birthday', rs_studentEntity.stu_birthday)#</cfoutput>" /><span id="calendarTrigger" class="btnCalendar"></span>
						</div>
                              
                              <div class="label">
							<span class="req">*</span><b>入学日期</b>
							<input name="dateJoin" id="dateJoin" type="text" class="typeDate" maxlength="10" verification="date" value="<cfoutput>#event.getArg('Birthday', rs_profileEntity.date_join)#</cfoutput>" /><span id="calendarTriggerDJ" class="btnCalendar"></span>
                                   <p class="notice" style="color:red">以上日期请按照‘YYYY-MM-DD’格式进行输入</p>
						</div>
						
						<hr/>
                             
                              
                              <div class="label">
							<b>性别</b>
							<input name="Sex" type="radio" class="typeRadio" value="1" <cfif event.getArg('Sex', rs_studentEntity.stu_sex) eq "1">checked="checked"</cfif> />男
							<input name="Sex" type="radio" class="typeRadio" value="2" <cfif event.getArg('Sex', rs_studentEntity.stu_sex) eq "2">checked="checked"</cfif> />女
						</div>
                              
                              <div class="label">
							<b>是否结婚</b>
							<input name="isMarried" type="radio" class="typeRadio" value="" checked="checked"/>无信息
							<input name="isMarried" type="radio" class="typeRadio" value="1" <cfif event.getArg('Sex', rs_profileEntity.is_married) eq "1">checked="checked"</cfif> />已婚
                                   <input name="isMarried" type="radio" class="typeRadio" value="0" <cfif event.getArg('Sex', rs_profileEntity.is_married) eq "0">checked="checked"</cfif> />未婚
						</div>
						
                               
                              <div class="label">
							<b>国家</b>
							<select name="countryName" class="inlinePart">
                                   	<option selected="selected" value="">无</option>
                                        <cfloop query="rs_country">
                                                     <option <cfif rs_country.name eq rs_studentEntity.nationality>selected="selected"</cfif> value="<cfoutput>#rs_country.name#</cfoutput>"><cfoutput>#rs_country.name#</cfoutput> </option>
								</cfloop>
							</select>
                                   
                                   洲别
							<select name="continent" class="inlinePart">
                                         <option selected="selected" value="">无</option>
                                         <cfloop query="rs_continent">
           							<option <cfif rs_continent.name eq rs_studentEntity.continent>selected="selected"</cfif> value="<cfoutput>#rs_continent.name#</cfoutput>"><cfoutput>#rs_continent.name#</cfoutput></option>
								</cfloop>
							</select>
						</div>
                              
                               <div class="label">
							<b>经费来源</b>
							<select name="funds" class="inlinePart">
                                   	<option value="" selected="selected">无</option>
                                        <cfloop query="rs_funds">
                                                     <option <cfif rs_profileEntity.f_id eq rs_funds.code_id>selected="selected"</cfif> value="<cfoutput>#rs_funds.code_id#</cfoutput>"><cfoutput>#rs_funds.name#</cfoutput> </option>
								</cfloop>
							</select>
                                   
						</div>
                              
						<hr/>
                              
                              <div class="label">
							<b>电子邮件</b>
							<input name="emailAddress" id="emailAddress" type="text" class="typeEnglish" maxlength="120" value="<cfoutput>#event.getArg('EmailAddress', rs_profileEntity.stu_email)#</cfoutput>" />
						</div>
                              
                              <div class="label">
							<b>联系电话</b>
							<input name="telephone" id="telephone" type="text" class="typeEnglish" maxlength="16" value="<cfoutput>#event.getArg('telephone', rs_profileEntity.stu_tel)#</cfoutput>" />
						</div>
                              
                               <div class="label">
							<b>在华住址</b>
							<input name="chAddr" id="chAddr" type="text" class="typeText" maxlength="36" value="<cfoutput>#event.getArg('chAddr', rs_profileEntity.ch_addr)#</cfoutput>" />
						</div>
                              
                               <div class="label">
							<b>固定地址</b>
							<input name="homeAddr" id="homeAddr" type="text" class="typeText" maxlength="36" value="<cfoutput>#event.getArg('homeAddr', rs_profileEntity.homeaddr)#</cfoutput>" />
						</div>
                              
                              <hr/>
						
						
						<div class="lable">
							<input class="button" type="submit" value="更新" />
						</div>
						
					</form>
					
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						$(document).ready(function() {
							Calendar.setup({
								trigger    : "calendarTrigger",
								inputField : "Birthday",
								animation  : false 
								});
								
							Calendar.setup({
								trigger    : "calendarTriggerPT",
								inputField : "ptDate",
								animation  : false
								});
							Calendar.setup({
								trigger    : "calendarTriggerDJ",
								inputField : "dateJoin",
								animation  : false
								});

						});
						// -->
						//]]>
					</script>
					
				</div>
				
				
				<div id="Picture" class="tabContent">
					<div class="noticeBlock">
						<h3>电子照片</h3>
						<hr/>
					</div>
					
					<div class="mbl">
						<img class="img_border" width="240" height="320" src="<cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/student/print/<cfoutput>#left(rs_studentEntity.stu_id,4)#</cfoutput>/<cfoutput>#rs_studentEntity.stu_id#</cfoutput>.jpg" />
					</div>

					<form target="output" id="formPic" onSubmit="javascript:return processVerfiyForm('formPic');" class="formWrapper" method="post" enctype="multipart/form-data" action="<cfoutput>#buildURL('uploadStudentPicDo')#</cfoutput>">
						<input type="hidden" name="StudentID" value="<cfoutput>#rs_studentEntity.stu_id#</cfoutput>" />
						
						<div class="label">
							<span class="req">*</span><b>更新照片</b>
							<input name="upload" id="upload" type="file" verification="required" />
							<p class="notice">请使用至少 480x640 尺寸（比例4:3）的 jpg 图片作为上传文件</p>
						</div>
						
						<div class="lable"><input id="importTrigger" class="button" type="submit" value="更新照片" /></div>
						
					</form>
					
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						$(document).ready(function() {
							$("#importTrigger").click(function(){
								
								if ( processVerfiyForm('formPic') ) {
									$("#output").attr("src","about:blank").removeClass("hidden_elem");
								}
								
							});
						});
						// -->
						//]]>
					</script>
					
					
					<iframe name="output" id="output" class="UIframeBox hidden_elem" src="about:blank" frameborder="0"></iframe>

				</div>
				
			</div>
		</li>
	</ul>
</div>
				
				